package com.heima.web.controller;

import com.heima.entry.FindNotWorkByTime;
import com.heima.entry.SelectWork;
import com.heima.mapper.AssignmentMapper;
import com.heima.pojo.Assignment;
import com.heima.pojo.utils.Result;
import com.heima.service.AssignmentService;
import com.heima.service.UserPracticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.Date;

/**
 * @ClassName UserPracticeController
 * @Author Administrator
 * @create 2022/11/13 16:34
 */
@RestController
@RequestMapping("/v1/work")
public class UserPracticeController {
    @Autowired
    UserPracticeService userPracticeService;

    @Autowired
    AssignmentService assignmentService;

    @PostMapping("/showWorks")
    public Result findStudentWork(@RequestBody SelectWork selectWork) throws ParseException {
                return userPracticeService.findAll(selectWork);
    }

    @PostMapping("/publishWork")
    public Result publishWork(@RequestBody Assignment assignment){
        return assignmentService.publishWork(assignment);
    }


    @PostMapping("/findNotWorkByTime")
    public Result findNotWorkByTime(@RequestBody FindNotWorkByTime findNotWorkByTime){
        return userPracticeService.findNotWorkByTime(findNotWorkByTime);
    }
}

